import React from 'react'
import '../assets/styles'
import '../assets/styles/monaco-editor-custom-style.scss'
import EditorTab from "./EditorTab";
import EditorContent from "./EditorContent";
import IndexService from "../service/IndexService";
import {connect} from 'react-redux';


class EditorWarp extends React.Component {
    //模板3
    __tabItem = {
        id: 1,
        name: '',
        extName: '',
        openTime: new Date(),
        isActive: true,
        isSave: false,
        contentId: '',
        content: ''
    };
    indexService = new IndexService();
    state = {
        tabList: [
            /* {
                 id: 1,
                 fileName: '张jkdflsjdlksf三三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isActive: true,
                 isSave: false,
                 content: '123'
             }, {
                 id: 2,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,

                 content: '1234'
             }, {
                 id: 3,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '12345'
             }, {
                 id: 4,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '1232111'
             }, {
                 id: 5,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '1232111'
             }, {
                 id: 6,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '1232111'
             }, {
                 id: 7,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '1232111'
             }, {
                 id: 8,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '1232111'
             }, {
                 id: 9,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '1232111'
             }, {
                 id: 10,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '1232111'
             }, {
                 id: 11,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '1232111'
             }, {
                 id: 12,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '1232111'
             }, {
                 id: 13,
                 fileName: 'jkdflsjdlksf三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '1232111'
             }, {
                 id: 14,
                 fileName: '张三.txt',
                 extName: '.txt',
                 openTime: new Date(),
                 isSave: false,
                 isActive: false,
                 content: '1232111'
             }*/
        ]
    }

    //获取当前活动的文件
    getActiveFile = () => {
        let {tabList} = this.state;
        for (let mItem of tabList) {
            if (mItem.isActive) {
                return mItem;
            }
        }
    }

    componentDidMount() {

    }


    render() {
        return (
            <div className='edit-warp'>
                <EditorTab/>
                <EditorContent/>
            </div>
        );
    }
}

export default connect((state, p) => {
    return {...state};
}, (dispatch) => {
    return {}
})(EditorWarp);
